using UnityEngine;

namespace IQIGame.USDK
{
    public class IQIUSDKImpl_UnityEditor : MonoBehaviour, IQIUSDKInterface
    {
        public void init()
        {
            IQIUSDK.Instance.OnInitSuccess();
        }

        public void login()
        {
            UserInfo userInfo = getUserInfo();
            IQIUSDK.Instance.OnLoginSuccess(userInfo);
        }

        public void logout()
        {
            IQIUSDK.Instance.OnLogoutSuccess();
        }

        public void exit()
        {
            IQIUSDK.Instance.OnExitSuccess();
        }

        public void switchAccount()
        {
            UserInfo userInfo = getUserInfo();
            IQIUSDK.Instance.OnSwitchSuccess(userInfo);
        }

        public bool isSupportExitDialog()
        {
            return true;
        }

        public bool isSupportSwitchAccount()
        {
            return true;
        }

        public void pay(PaymentParameters orderInfo, RoleInfo roleInfo)
        {
            PayResultData payResultData = new()
            {
                sdkOrderId = "test_sdkOrderId",
                cpOrderId = orderInfo.cpOrderId,
                cpExtras = orderInfo.cpExtras,
                msg = "test_msg"
            };
            IQIUSDK.Instance.OnPaySuccess(payResultData);
        }

        public void extraFunc(ExtraFuncType type, string jsonData)
        {
            ExtraFuncData extraFuncData = new()
            {
                type = (int)type,
                json = "{\"test\":\"test\"}"
            };
            IQIUSDK.Instance.OnExtraFuncSuccess(extraFuncData);
        }

        public void setAgreeProtocol()
        {
        }


        public void enterGame(RoleInfo roleInfo)
        {
        }

        public void createNewRole(RoleInfo roleInfo)
        {
        }

        public void roleLevelUp(RoleInfo roleInfo)
        {
        }

        public void roleSelectServer(RoleInfo roleInfo)
        {
        }

        public void roleExitGame(RoleInfo roleInfo)
        {
        }

        public void roleReport(RoleInfo roleInfo)
        {
        }




        public int getChannelId()
        {
            return 6;
        }

        public string getChannelName()
        {
            return "test_channelName";
        }

        public int getImgId()
        {
            return 999;
        }

        public string getCpsId()
        {
            return "test_cpsId";
        }

        public string getChannelSDKVersion()
        {
            return "test_ChannelSDKVersion";
        }

        public string getUSDKVersion()
        {
            return "test_USDKVersion";
        }

        public string getCustomParams(string key)
        {
            return "test_CustomParams";
        }

        public string getUniqueId()
        {
            return "";
        }

        public string getTraceID()
        {
            return "";
        }

        private UserInfo getUserInfo()
        {
            return new()
            {
                channelUid = "test-uid",
                channelId = getChannelId().ToString(),
                token = "test-token",
                username = "testusername"
            };
        }


    }
}